From 125dd7d4fc70f79e1009bb2395e2deaea7c044aa Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 30 Aug 2005 17:38:17 +0000 Subject: [PATCH] Jeff Kalikstein adds heart rate support for Forerunner 301. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@1379 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/csv_util.c | 7 +++++++ gpsbabel/defs.h | 3 ++- gpsbabel/garmin.c | 1 + gpsbabel/style/README.style | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index 5979486e3..e2ad5db8a 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -926,6 +926,9 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp) if ( strcmp( fmp->key, "PATH_DISTANCE_MILES") == 0) { /* Ignored on input */ } else + if ( strcmp( fmp->key, "HEART_RATE") == 0) { + wpt->heartrate = atoi(s); + } if ( strcmp( fmp->key, "PATH_DISTANCE_KM") == 0 ) { /* Ignored on input */ } else { @@ -1260,6 +1263,10 @@ xcsv_waypt_pr(const waypoint *wpt) writebuff( buff, fmp->printfc, wpt->course ); } else + /* HEART RATE CONVERSION***********************************************/ + if (strcmp(fmp->key, "HEART_RATE") == 0) { + writebuff(buff, fmp->printfc, wpt->heartrate); + } else /* TIME CONVERSIONS**************************************************/ if (strcmp(fmp->key, "EXCEL_TIME") == 0) { /* creation time as an excel (double) time */ diff --git a/gpsbabel/defs.h b/gpsbabel/defs.h index c949a3177..f1bb85703 100644 --- a/gpsbabel/defs.h +++ b/gpsbabel/defs.h @@ -289,7 +289,8 @@ typedef struct { float speed; /* Optional: meters per second. */ fix_type fix; /* Optional: 3d, 2d, etc. */ int sat; /* Optional: number of sats used for fix */ - + + int heartrate; /* Beats per minute: likely to get moved to fs. */ geocache_data gc_data; format_specific_data *fs; void *extra_data; /* Extra data added by, say, a filter. */ diff --git a/gpsbabel/garmin.c b/gpsbabel/garmin.c index 75fc9e1fb..8557ae1df 100644 --- a/gpsbabel/garmin.c +++ b/gpsbabel/garmin.c @@ -287,6 +287,7 @@ track_read(void) wpt->longitude = array[i]->lon; wpt->latitude = array[i]->lat; wpt->altitude = array[i]->alt; + wpt->heartrate = array[i]->heartrate; wpt->shortname = xstrdup(array[i]->trk_ident); wpt->creation_time = array[i]->Time; diff --git a/gpsbabel/style/README.style b/gpsbabel/style/README.style index b191b9bd1..f59ef1869 100644 --- a/gpsbabel/style/README.style +++ b/gpsbabel/style/README.style @@ -327,6 +327,12 @@ The fields used by the XCSV parser are as follows: ALT_METERS is identical to ALT_FEET with the exception that the altitude is in METERS. + o HEART_RATE + Heart rate, measured in beats per minute. Only valid for units with + heart rate monitor features (i.e. Garmin Forerunner 301). + + example: IFIELD HEART_RATE,"","%d" + o EXCEL_TIME EXCEL_TIME is the waypoint's creation time, if any. This is actually the decimal days since 1/1/1900 and is handled internally as a DOUBLE -- 2.30.2